import {baseApiF} from './api'
let baseApi = baseApiF()
// 获取年住院人次人头综合分析数据
export function getInHosPeopTimesPeopNumData(planAreaId, hospitalId) {
  const data = Object.assign({}, {
    planAreaId,
    hospitalId
  })
  return window.axios.post(baseApi + 'report/queryInHospitalCountsNumsRatio', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 平均住院日综合分析接口 (type人均传1,次均传2)
export function getYearAverageInHosDaysData(planAreaId, hospitalId, type) {
  const data = Object.assign({}, {
    planAreaId,
    hospitalId,
    type
  })
  return window.axios.post(baseApi + 'report/queryAvgInHospitalDay', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 百元医疗收入消耗的卫生材料费用接口
export function getHundredMedCostCustomData(areaCode, hospLevel, hospCode) {
  const data = Object.assign({}, {
    areaCode,
    hospLevel,
    hospCode
  })
  return window.axios.post(baseApi + 'report/oneHundredHealthMaterialFeeAnalysis', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 各医疗类别占医疗收入比重分析接口
export function getMedicalTypeAnalyseData(hospitalLevel, year, planAreaId, hospitalId, freeSortType,
                                          resultLevel, resultId) {
  const data = Object.assign({}, {
    hospitalLevel,
    year,
    planAreaId,
    hospitalId,
    freeSortType,
    resultLevel,
    resultId
  })
  return window.axios.post(baseApi + 'report/queryMedicalsInMedicalOperation', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 收入类别占医疗收入比重分析接口
export function getCostTypeAnalyseData(hospitalLevel, year, planAreaId, hospitalId,
                                       resultLevel, resultId) {
  const data = Object.assign({}, {
    hospitalLevel,
    year,
    planAreaId,
    hospitalId,
    resultLevel,
    resultId
  })
  return window.axios.post(baseApi + 'report/queryChargesInMedicalOperation', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 获取医院就诊人次人数占比分析左侧直方图
export function getHospitalInPeopleNumData(areaCode, hospLevel, medicalCategory, queryYear, type) {
  const data = Object.assign({}, {
    areaCode,
    hospLevel,
    medicalCategory,
    queryYear,
    type
  })

  return window.axios.post(baseApi + 'person/treatmentProportionAnalysis', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}


// 获取医院就诊人次人数占比分析左侧直方图----右侧
export function getHospitalInPeopleNumDataRight(areaCode, hospLevel, medicalCategory, queryYear) {
  const data = Object.assign({}, {
    areaCode,
    hospLevel,
    medicalCategory,
    queryYear
  })

  return window.axios.post(baseApi + 'person/treatmentPersonAnalysis', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}


// 获取10种典型单病种例均费用
export function getTenSingleTypeDiseaseCostData(queryYear, areaCode, hospLevel, hospCode,
                                                medicalCategory, typicalDrgs, resultLevel, resultId) {
  const data = Object.assign({}, {
    queryYear,
    areaCode,
    hospLevel,
    hospCode,
    medicalCategory,
    typicalDrgs,
    resultLevel,
    resultId
  })

  return window.axios.post(baseApi + 'report/typicalDrgsCasesCostAnalysis', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 城镇职工基本医疗保险运行情况分析 （表格）
export function getTownWorksBasicMedicalData(areaId, beginDate, endDate) {
  const data = Object.assign({}, {
    areaId,
    beginDate,
    endDate
  })

  return window.axios.post(baseApi + 'excel/townWorksBasicMedicareAnalysis', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

//编辑表格钱数
export function setCollectionPlanMoney(money, year) {
  const data = Object.assign({}, {
    money,
    year
  })

  return window.axios.post(baseApi + 'excel/setCollectionPlanMoney', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

//获取养老保险抚养比分析
export function getOldInsuranceRaisingAnalyse(areaCode) {
  const data = Object.assign({}, {
    areaCode
  })

  return window.axios.post(baseApi + 'report/queryYangLaoFuYangBi', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

//获取养老保险抚养比分析
export function getOldInsuranceRaisingAnalyse1(year) {
  const data = Object.assign({}, {
    year
  })

  return window.axios.post(baseApi + 'hr/queryApplyDemandMonth', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

//获取养老保险抚养比分析
export function getOldInsuranceRaisingAnalyse2(year) {
  const data = Object.assign({}, {
    year
  })

  return window.axios.post(baseApi + 'hr/queryApplyDemandEdu', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

//获取养老保险抚养比分析
export function getOldInsuranceRaisingAnalyse3(year) {
  const data = Object.assign({}, {
    year
  })

  return window.axios.post(baseApi + 'hr/queryApplyDemandCategory', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

//获取养老保险抚养比分析详情
export function getOldInsuranceRaisingAnalyseDetail(areaCode, queryYear) {
  const data = Object.assign({}, {
    areaCode,
    queryYear
  })

  return window.axios.post(baseApi + 'report/queryDetailYangLaoFuYangBi', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

//获取退休人员年份预测分析
export function getRetirePeoplePredictAnalyse(areaCode) {
  const data = Object.assign({}, {
    areaCode
  })

  return window.axios.post(baseApi + 'report/retirementForecastYearQuery', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

//获取退休人员月份预测分析
export function getRetirePeoplePredictAnalyseDetail(areaCode, queryYear) {
  const data = Object.assign({}, {
    areaCode,
    queryYear
  })

  return window.axios.post(baseApi + 'report/retirementForecastMonthQuery', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

//获取基于缴费工资的缴费水平分析
export function getBaseSalaryLevelAnalyse(areaCode) {
  const data = Object.assign({}, {
    areaCode
  })

  return window.axios.post(baseApi + 'report/queryJiaoFeiBySalary', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 获取基于缴费基数的人员分析
export function getBasePaymentPeopleAnalyse(areaCode, baoXianType, queryYear) {
  const data = Object.assign({}, {
    areaCode,
    baoXianType,
    queryYear
  })

  return window.axios.post(baseApi + 'report/personnelAnalysis', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 获取基于缴费基数的人员分析
export function getBasePaymentPeopleAnalyse1(year) {
  const data = Object.assign({}, {
    year
  })

  return window.axios.post(baseApi + 'hr/queryApplyDemandSex', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}


// 获取病种支出分析
export function getDiseaseTypeCostAnalyse(areaCode, disName, hospCode, hospLevel,
                                          medicalCategory, paixu, queryYear, topNum) {
  const data = Object.assign({}, {
    areaCode, disName, hospCode, hospLevel,
    medicalCategory, paixu, queryYear, topNum
  })

  return window.axios.post(baseApi + 'disexp/dislist', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 获取收费类别分析和支付比例分析
export function getCostTypeAnalyseAndPayRateAnalyse(areaCode, disCode, hospCode, hospLevel,
                                                    medicalCategory, queryYear) {
  const data = Object.assign({}, {
    areaCode, disCode, hospCode, hospLevel,
    medicalCategory, queryYear
  })

  return window.axios.post(baseApi + 'disexp/disratio', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 获取基于病种的平均住院日分析
export function getPersonInHosAnalyse(areaCode, bingZhongId, hospCode, hospLevel,
                                      medicalCategory, paixu) {
  const data = Object.assign({}, {
    areaCode, bingZhongId, hospCode, hospLevel,
    medicalCategory, paixu
  })

  return window.axios.post(baseApi + 'person/inHospAnalysis', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}






